/ Assembly List / LJCWinFormCommon / FormCommon / SaveFile

Namespace - LJCWinFormCommon


Parameters
filter - The file filter.
initialDirectory - The initial selected directory.
defaultFileSpec - The default file specification.

Returns

The file specification. A null string if the "Cancel" button is selected.

Syntax

C#
public static String SaveFile(String filter, String initialDirectory = null, String defaultFileSpec = null)

Displays the Save dialog to select a file.

Example

C#
// No Spaces in filter file spec.
var filter = "csv files(*.csv)|*.csv|txt files(*.txt)|*.txt|All files(*.*)|*.*";
var initialDirectory = Directory.GetCurrentDirectory();
var inputFileSpec = FormCommon.SaveFile(filter, initialDirectory);
if (inputFileSpec != null)
{
// Process File
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.